package com.test.learnopenglandroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.test.learnopenglandroid.chapter1.Chapter1;
import com.test.learnopenglandroid.chapter2lighting.Chapter2;
import com.test.learnopenglandroid.chapter4advancedopengl.Chapter4;
import com.test.learnopenglandroid.chapter5.Chapter5;

public class MainActivity extends Activity {

    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
    }

    private LinearLayout mChapterLayout;
    private LinearLayout mButtonLayout;
    private FrameLayout mViewLayout;

    private void addTest(ViewGroup root,String name, View.OnClickListener testFun){
        Button btn =new Button(this);
        btn.setText(name);
        btn.setOnClickListener(testFun);
        btn.setTextSize(10.0f);
        root.addView(btn);
    }

    private void addTest(ViewGroup root,String name, View.OnClickListener testFun, View.OnClickListener arrowBtnClick){
        Button btn =new Button(this);
        btn.setText(name);
        btn.setOnClickListener(testFun);
        btn.setTextSize(10.0f);
        root.addView(btn);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mButtonLayout = findViewById(R.id.buttonLayout);
        mViewLayout = findViewById(R.id.viewLayout);
        mChapterLayout = findViewById(R.id.chapterSelect);

        Chapter1.init(mChapterLayout,mButtonLayout,mViewLayout);
        Chapter2.init(mChapterLayout,mButtonLayout,mViewLayout);
        Chapter4.init(mChapterLayout,mButtonLayout,mViewLayout);
        Chapter5.init(mChapterLayout,mButtonLayout,mViewLayout);
    }
}
